﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

/// <summary>
/// Summary description for BWDiemDanhTVV
/// </summary>
namespace BCDataCenter.BOL
{
    public class BWDiemDanhTVV
    {
        string SqlGetInfoTuVanVien = "get_InfoTuVanVien";
        string SqlDiemDanh = "Tr_DiemDanhTVVMmYyyy";
        string SqlGetWorkingDay = "Tr_GetNgayLamViec";
        public BWDiemDanhTVV()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public string getWorkingDay(ref string error, string SiteCode)
        {
            DataAccessLayer.DAL obj = new BCDataCenter.DataAccessLayer.DAL();
            return obj.MyExecuteQuerys(ref error, SqlGetWorkingDay, CommandType.StoredProcedure, new SqlParameter("@Sitecode", SiteCode));
        }

        public bool IsExistTVV(ref string error, string MaTVV)
        {
            return new DataAccessLayer.DAL().IsExistFromSQL(SqlGetInfoTuVanVien, System.Data.CommandType.StoredProcedure, ref error, new SqlParameter("@MaTVV", MaTVV));
        }

        public bool setNgaylamViec(ref string error, string SiteCode, string MaTVV, string WorkingDay, bool isPresent)
        {
            return new DataAccessLayer.DAL().MyExecuteNonQuery(SqlDiemDanh, CommandType.StoredProcedure, ref error,
                new SqlParameter("@SiteCode", SiteCode),
                new SqlParameter("@Salesp_Key", MaTVV),
                new SqlParameter("@WorkingDay", WorkingDay),
                new SqlParameter("@isPresent", isPresent));
        }
    }
}
